package main

import (
	"fmt"
)

var a int8
var b uint8
var c uint8
func main() {
	//整型
	//a = 100
	//fmt.Println(a)
	//无符号位8位整型 注意计算 溢出
	//b = 1
	//c = 2
	//fmt.Println(b - c)
	//进制表示
	//bin_num := 0b11
	//oct_num2 := 0o11
	//hex_num3 := 0x11
	//fmt.Println(bin_num, oct_num2, hex_num3)

	//浮点判断
	//var f1 float64
	//var f2 float64
	//var f3 float64
	//f1 = 0.111111
	//f2 = 0.222222
	//f3 = 0.333333
	//if f1 + f2 == f3{
	//	fmt.Println("ok")
	//}else {
	//	fmt.Println("error")
	//}

	//x := decimal.NewFromFloat(0.111111)
	//y := decimal.NewFromFloat(0.222222)
	//z := decimal.NewFromFloat(0.333333)
	//if x.Add(y).Equal(z) {
	//	fmt.Println("ok")
	//}

	//编码 人类语言
	//byte rune 字符类型 编码
	//byte -- int8
	//rune -- int32
	//ASCII UTF-8 GBK
	//var c1 byte
	//c1 =97
	//fmt.Println(c1, string(c1))
	//for _, v := range "abcxyz"{
	//	fmt.Println(v)
	//	fmt.Printf("%v(%c), type is %T\n", v, v, v)
	//}
	//字符串格式化
	//格式化好的字符串赋值 在python中可以直接赋值
	//format.str := "name is %s" %(name)
	//把格式化好的字符串赋值给另一个变量 spintf
	//format_str := fmt.Sprintf("nam is %s","sctl")
	//fmt.Printf(format_str)

	//统计字符串的长度 --占用字节数
	//len_str := len("xxxyyy")
	//fmt.Println(len_str)
	//str1 := "xx中文"
	//for i := 0 ; i<len(str1); i++{
	//	//通过下标获取的是一个个字节表示，中文占用3个字节
	//	fmt.Printf("%v(%c), type is %T \n", str1[i])
	//}

	//接受用户从键盘输入的字符串，统计出现次数最多的字符,输出是哪个字符和它出现的次数
	//var str1 string
	//fmt.Scanln(&str1)
	//string_max := ""
	//count_max := 0
	//for _, i := range str1{
	//	count := strings.Count(str1,string(i))
	//	if count > count_max{
	//		count_max = count
	//		string_max = string(i)
	//	}
	//
	//
	//
	//}
	//fmt.Printf("出现次数最多的字符是%s，出现次数为%d次", string_max, count_max)

	//转义字符
	//str1 := "a\tb"
	//fmt.Println(str1)
	//str2 :=`a\tb`
	//fmt.Println(str2)

	//字符串的转换
	//number1 := 10
	//str1 := strconv.Itoa(number1)
	//fmt.Printf("str1 is %T \n", str1)
	//str --> int
	//v, e := strconv.Atoi("10") //返回两个值，不能转换 e就会拿到错误信息

	//string常用方法 --> strings包
	//str1 := "xixihaha"
	//if strings.HasPrefix(str1, "x"){
	//	fmt.Println("str1 start with x")
	//}
	//
	//fmt.Println(strings.Count(str1,"h"))

	//字符串的截取
	//str[start:end]
	//str1 := "abcdefg"
	//fmt.Println(str1[2:5]) //左闭右开
	//fmt.Println(str1[-3]) 没有负下标

	//布尔类型
	//var a bool  // 默认值是false
	//fmt.Println(a)
	fmt.Print("请输入：")
	var flag int=0
	var num string
	fmt.Scanln(&num)

	//for _, i :=range num {
	//	if string(i) != "1" && string(i) != "2" && string(i) != "3" && string(i) != "4" && string(i) != "5" && string(i) != "6" && string(i) != "7" && string(i) != "8" && string(i) != "9" && string(i) != "0" {
	//		flag = 1
	//		break
	//	}
	//}
	//if flag == 0{
	//	fmt.Println("整型")
	//}else{
	//	fmt.Println("不是整型")
	//}
	//

	if num[:2] == "0b" || num[:2] == "0x" || num[:2] == "0o"{
		if num[:2] == "0b" {
			for _, i :=range num[2:] {
				if string(i) != "1" && string(i) != "0" {
					flag = 1
					break
				}
			}
			if flag == 0{
				fmt.Println("整型")
			}else{
				fmt.Println("不是整型")
			}
		}else if num[:2] == "0o"{
			for _, i :=range num[2:] {
				if string(i) != "1" && string(i) != "2" && string(i) != "3" && string(i) != "4" && string(i) != "5" && string(i) != "6" && string(i) != "7" && string(i) != "0" {
					flag = 1
					break
				}
			}
			if flag == 0{
				fmt.Println("整型")
			}else{
				fmt.Println("不是整型")
			}
		}else if num[:2] == "0x" {
			for _, i :=range num[2:] {
				if string(i) != "1" && string(i) != "2" && string(i) != "3" && string(i) != "4" && string(i) != "5" && string(i) != "6" && string(i) != "7" && string(i) != "8" && string(i) != "9" && string(i) != "0" && string(i) != "a"&& string(i) != "b"&& string(i) != "c"&& string(i) != "d"&& string(i) != "e"&& string(i) != "f"{
					flag = 1
					break
				}
			}
			if flag == 0{
				fmt.Println("整型")
			}else{
				fmt.Println("不是整型")
			}
		}
	}else {
		for _, i :=range num {
			if string(i) != "1" && string(i) != "2" && string(i) != "3" && string(i) != "4" && string(i) != "5" && string(i) != "6" && string(i) != "7" && string(i) != "8" && string(i) != "9" && string(i) != "0" {
				flag = 1
				break
			}
		}
		if flag == 0{
			fmt.Println("整型")
		}else{
			fmt.Println("不是整型")
		}

	}


}
